package com.itheima.mapper;

import com.itheima.pojo.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentMapper {

    List<Student> page(String name, Integer degree, Integer clazzId);


    void add(Student student);

    @Select("select id, name, no, gender, phone, id_card idCard, is_college isCollege, address, degree, graduation_date graduationDate, clazz_id clazzId, violation_count violationCount, violation_score violationScore, create_time createTime, update_time updateTime from student where id = #{id}")
    Student getInfo(Integer id);

    void update(Student student);

    void delete(List<Integer> ids);

    void violation(Integer id, Integer score);

    @MapKey("name")
    List<Map<String, Object>> countStudentDegreeData();
}
